package com.lesserpand.springcloudalibabasso.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * @author pand
 * @version 0.0.1
 * @package com.lesserpand.story.authorization.configuration
 * @description oauth password 模式设置 header
 * @date Created in 2018/7/21 12:02
 * @company story
 * @copyright Copyright (c) 2017
 * @modified By
 */
@Service(value = "authrizationInterceptor")
public class AuthorizationInterceptor implements RequestInterceptor {

    @Value("${header.authorization}")
    private String authorization;

    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header("Authorization", authorization);
    }
}
